<%--
  Created by IntelliJ IDEA.
  User: dream
  Date: 14-4-4
  Time: 下午11:14
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@include file="../header.jsp"%>
<jsp:include page="../taglib.jsp"></jsp:include>
<html>
<head>
    <title></title>
</head>
<body>
<div class="easyui-panel default_container" data-options="fit:true,border:false">
    <table id="demo_table" class="default_table">
    </table>
    <div id="demo_toolbar" class="default_toolbar">
        <div style="float: left">
            <a href="javascript:void(0)" class="easyui-linkbutton add_button" id="demo_add_button" iconCls="icon-add"
               plain="true">添加</a>
            <a href="javascript:void(0)" class="easyui-linkbutton remove_button" id="demo_remove_button"
               iconCls="icon-remove" plain="true">删除</a>
        </div>
        <div style="float: right;margin-left: 20px">
            <a href="javascript:void(0)" url="${ctx}/demo/search.do" windowId="demo_search_window"
               class="advance_search_form_show">高级查询</a>
        </div>
        <div style="float: right;display: none;">
            <input id="demo_search_box" class="default_search_box">

            <div class="default_search_menu">
                <div data-options="name:'all'">全部</div>
                <div data-options="name:'propStr'">propStr</div>
            </div>
        </div>
        <div class="clear"></div>
    </div>
</div>
<script>
    var demo_table = $('#demo_table');
    var demo_serach_box = $('#demo_search_box');
    $(function () {
        demo_table.initGrid({
            url: '${ctx}/demo/getGridData.do',
//            fitColumns:false,
            toolbar: '#demo_toolbar',
            searchForm: '#demo_search_form',
            columns: [
                [
                    {field: 'ck', checkbox: true},
                    {field: "id", title: "ID", align: 'center', hidden: true},
                    {field: 'propStr', title: 'propStr', width: 100, align: 'center',
                        formatter: function (value, row, index) {
                            return "<a href=\"#\" onclick=\"demo_view('" + row.id + "'" + ")\">" + row.propStr + "</a>";
                        }},
                    {field: 'propLong', title: 'propLong', width: 100, align: 'center'},
                    {field: 'propInteger', title: 'propInteger', width: 100, align: 'center'},
                    {field: 'propDouble', title: 'propDouble', width: 100, align: 'center'},
                    {field: 'propDate', title: 'propDate', width: 100, align: 'center'},
                    {field: 'description', title: '备注', width: 100, align: 'center'},
                    {field: 'operate', title: '操作', width: 100, align: 'center',
                        formatter: function (value, row, index) {
                            var edit_button = "<a href=\"#\" onclick=\"demo_edit('" + row.id + "'" + ")\">" + "编辑" + "</a>";
                            return edit_button;
                        }}
                ]
            ]
        });
        demo_serach_box.initSearchBox(demo_table);

    })

    function demo_edit(id) {
        var urlParams = '?id=' + id;
        $.openWindow('${ctx}/demo/edit.do' + urlParams, 'demo_add_window', '编辑单表（无关联）信息', 800, 400);
    }

    function demo_view(id) {
        var urlParams = '?id=' + id;
        $.openWindow('${ctx}/demo/view.do' + urlParams, 'demo_view_window', '编辑单表（无关联）信息', 800, 400);
    }

    $('#demo_add_button').click(function () {
        $.openWindow('${ctx}/demo/add.do', 'demo_add_window', '添加单表（无关联）信息', 800, 400);
    });
    $('#demo_remove_button').click(function () {
        demo_table.doDelete({url: '${ctx}/demo/delete.do'});
    });
</script>
</body>
</html>